package io.renren.membermanage.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.constant.BizSystemException;
import io.renren.membermanage.entity.ImageGenerateParam;
import io.renren.membermanage.mappper.ImageGenerateParamMapper;
import io.renren.membermanage.service.ImageGenerateParamService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class ImageGenerateParamServiceImpl extends ServiceImpl<ImageGenerateParamMapper, ImageGenerateParam> implements ImageGenerateParamService {

    public List<ImageGenerateParam> getImageGenerateParam(String type) {
        LambdaQueryWrapper<ImageGenerateParam> queryWrapper = new LambdaQueryWrapper<ImageGenerateParam>();
        queryWrapper.eq(ImageGenerateParam::getType, type);
        queryWrapper.eq(ImageGenerateParam::getDelFlag, "0");
        List<ImageGenerateParam> list = this.list(queryWrapper);
        if (CollUtil.isEmpty(list)) {
            throw new BizSystemException("当前类型不存在可用的参数请确认！");
        }
        return list;
    }
}
